#!/bin/sh
#                       SCF - SwinConFiguration filename
#                       SAV- name of Saved file.
#                       SYS- name of System wide configuration defaults file.
PATH=/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/usr/bin/X11
export PATH
SCF=$HOME/.swin2config
SAV=$SCF.pre2.00
SYS=$SWIN2HOME/sys.swin2config
HINTS=$SWIN2HOME/swin_hints 
HINTS_HTML=$SWIN2HOME/swin_hints.html
VIEWED=$SWIN2HOME/swin_hints_viewed
FGREP=/usr/bin/fgrep
GREP=/sbin/grep
UNAME=/sbin/uname
XCONFIRM=/usr/bin/X11/xconfirm
CAT=/sbin/cat
CPIO=/sbin/cpio
AWK=/usr/bin/awk
FIND=/sbin/find
SED=/sbin/sed
PS=/sbin/ps
SLEEP=/sbin/sleep
NETSCAPE=/usr/bin/X11/netscape
CSH=/sbin/csh

# The following displays swin_hints if they haven't been seen
# by this user before, or if the sysadmin clears the user's
# name from the $VIEWED file (because the hints have changed).

# Note that if licensing needs to be done, the hints come up
# on top of the licensing window.  Not on top of the DOS or
# MS-windows window.

if $FGREP -s $USER $VIEWED ; then
	exit 0;
fi

$CSH -f $SWIN2HOME/bin/scripts/user_env.sw

( if [ -r $HINTS ] ; then
    WAIT=5
    while [ $WAIT -gt 0 ]
    do
        $SLEEP 2
        PROC=`$PS -e | $AWK '{ print $4 }' | $GREP swin | $GREP -v grep`
        if [ "$PROC" = "" ] ; then
            WAIT=`expr $WAIT - 1`
        else
            WAIT=0
        fi
    done
    $SLEEP 5
	if [ -r $HINTS_HTML -a -x $NETSCAPE ] ; then
			$NETSCAPE $HINTS_HTML & 
	else
    	dd=`$XCONFIRM -c -B Ok -file $HINTS \
         	-header "SoftWindows Usage Hints" -useslider &`
	fi
    echo $USER >>$VIEWED
fi ) &
exit 0;
